package com.supor.aiot.mine.api;

import com.android.baseconfig.base.BaseApiResult;
import com.android.baseconfig.base.BaseRetrofit;
import com.android.baseconfig.base.DataApiResult;
import com.supor.aiot.mine.bean.IpsBean;

import java.util.List;

import io.reactivex.rxjava3.core.Observable;

/**
 * ---------------------------------------------------------------- <br>
 * Copyright (C) 2014-2020, by het, Shenzhen, All rights reserved.  <br>
 * ---------------------------------------------------------------- <br>
 * <p>
 * 描述: UserImpl <br>
 * 作者: lei <br>
 * 日期: 2020/11/7 <br>
 */
public class IpsImpl extends BaseRetrofit<IpsService> implements IpsService {
    private static IpsImpl instance;

    public static IpsImpl getInstance() {
        if (instance == null) {
            instance = new IpsImpl();
        }
        return instance;
    }

    /**
     * 新增创意接口
     *
     * @param ipsBean ipsBean
     * @return BaseApiResult<String>
     */
    public Observable<BaseApiResult<String>> addIps(IpsBean ipsBean) {
        return api.addIps(ipsBean).compose(this.applySchedulers());
    }

    /**
     * 更新创意接口
     *
     * @param ipsBean ipsBean
     * @return BaseApiResult<String>
     */
    public Observable<BaseApiResult<String>> updateIps(IpsBean ipsBean) {
        return api.updateIps(ipsBean).compose(this.applySchedulers());
    }

    @Override
    public Observable<BaseApiResult<DataApiResult<List<IpsBean>>>> getIpsList(int page,
                                                                                int limit) {
        return api.getIpsList(page, limit).compose(this.applySchedulers());
    }

    @Override
    public Observable<BaseApiResult<String>> deleteIps(String id) {
        return api.deleteIps(id).compose(this.applySchedulers());
    }

}
